﻿@model CmsContentModel

@{
    ResFile = "cms_Content";
    ViewBag.Title = _("Edit new content");
    Layout = "~/admin/Templates/TelerikAdministration.cshtml";
}

@helper SaveButton()
{
    switch (Model.EditMode)
    {
        case EditMode.Usual:
            <input class="b-button" id="btnAdd" name="btnAdd" type="submit" value="@_("Save")" />
            break;
        case EditMode.Revision:
        <input class="b-button js-confirm" data-message="@_("New revision will be created based on the current one! Continue?")" id="btnAdd" name="restore" type="submit" value="@_("Restore as latest revision")" />
            break;
        case EditMode.Deleted:
            break;
    }
}

@helper BackButton()
{
    switch (Model.EditMode)
    {
        case EditMode.Usual:
            <p><a class="b-back-link" href="/admin/cmscontenttype/edit/@Model.ContentTypeId"><i class="b-icon"></i> @_("Show all '{0}' items", ViewBag.ContentTypeName)</a></p>
            break;
        case EditMode.Revision:

            break;
        case EditMode.Deleted:
            break;
    }
}

@BackButton()

<h1>@_("{0} - content details", ViewBag.ContentTypeName)</h1>

@using (Html.BeginForm("Edit", "CmsContent", new { id = Model.Id }))
{
    if (Model.ContentType.IsSupportedRevisions)
    {
        <a href="@Url.Action("Revisions", "CmsContent", new { publicId = Model.PublicContentId, typeId = Model.ContentTypeId })" class="b-button js-common-fancy">@_("Show Revisions")</a>
        <br class="clearall" />
        <br />
    }
    Html.RenderAction("contentdetails", "cmscontent", new { id = Model.Id, contenttypeid = @Model.ContentTypeId, mode = Model.EditMode });
    Html.ValidationSummary();

    <div class="b-form__button">
        @SaveButton()
    </div>
}	